package com.sky.mapper;

import com.sky.annotation.AutoFill;
import com.sky.entity.ShoppingCart;
import com.sky.enumeration.OperationType;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;

import java.util.List;

@Mapper
public interface ShoppingCartMapper {
    List<ShoppingCart> list(ShoppingCart shoppingCart);
    @AutoFill(value = OperationType.UPDATE)
    void updateNumberById(ShoppingCart cart);
    //@AutoFill(value = OperationType.INSERT)
    void insert(ShoppingCart shoppingCart);
    @Delete("delete from shopping_cart where user_id = #{userId}")
    void clean(long userId);
    @Delete("delete from shopping_cart where (dish_id = #{id} or setmeal_id =#{id}) ")
    void deleteById(Long id);
    //@AutoFill(value = OperationType.INSERT)
    void insertBatch(List<ShoppingCart> shoppingCartList);
}
